<template>
  <div class="type">
    <ul class="type-list">
      <li v-for="(item, index) in categoryList" :key="index"
        :class="{active: index=== currentIndex}" @click="selectClick(index,item.maitKey)">
        {{ item.title }}
      </li>
    </ul>
  </div>
</template>

<script>
export default {
  name: 'Type',
  props: {
    categoryList: {
      type: Array,
      default () {
        return [];
      }
    }
  },
  data () {
    return {
      currentIndex: 0
    }
  },
  methods: {
    selectClick (index, maitKey) {
      this.$emit('getMaitkey', maitKey)
      this.currentIndex = index
    }
  },

}
</script>

<style scoped>
.type-list li {
  width: 100px;
  height: 70px;
  background-color: rgb(233, 233, 233);
  text-align: center;
  line-height: 70px;
}
.type-list .active {
  border-left: 3px solid rgb(236, 45, 77);
  background-color: #fff;
}
</style>
